package com.zhongyewx.teachercert.ui.fragment;

import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.zhongyewx.teachercert.R;
import com.zhongyewx.teachercert.base.ZYBaseFragment;
import com.zhongyewx.teachercert.views.DrawSecondBesselView;
import com.zhongyewx.teachercert.views.MyHeartGiftView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

public class ZYTwoFragment extends ZYBaseFragment {

    @BindView(R.id.draw_wave)
    DrawSecondBesselView drawWave;
    @BindView(R.id.heart_view)
    MyHeartGiftView heartView;
    Unbinder unbinder;
    Unbinder unbinder1;
    private CountDownTimer timer;

    @Override
    public int getLayoutId() {
        return R.layout.fragment_two_layout;
    }

    @Override
    public void initView() {
        drawWave.startAnimation();
    }

    @Override
    public void initData() {
        timer = new CountDownTimer(100*1000, 200) {
            @Override
            public void onTick(long millisUntilFinished) {
                heartView.addHeartGift();
            }

            @Override
            public void onFinish() {

            }
        }.start();

    }

    @Override
    public void lazyLoad() {

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (timer != null) {
            timer.cancel();
            timer = null;
        }
        drawWave.release();
    }

    @OnClick(R.id.draw_wave)
    public void onViewClicked() {
        heartView.addHeartGift();
    }
}
